import React from 'react'
import { useDispatch, useSelector } from 'react-redux'

function FunctionHookTest() {
  // 获取 Redux state
  const value = useSelector((state) => state.value);

  // 获取 dispatch 方法
  const dispatch = useDispatch();


  return (
    <div>
      <h2>函数组件 + Hook</h2>
      <p>当前值: {value}</p>
      <button onClick={() => dispatch({ type: "counter/incremented" })}>+1</button>
      <button onClick={() => dispatch({ type: "counter/decremented" })}>-1</button>
    </div>
  );
}

export default FunctionHookTest
